package de.unibi.comet.util;

public class LatexUtils {

	/** Makes a strings suitable for latex printing, i.e. escape critical characters, etc.. */
	static public String format(String s) {
		StringBuffer sb = new StringBuffer();
		for (int i=0; i<s.length(); ++i) {
			sb.append(format(s.charAt(i)));
		}
		return sb.toString();
	}

	/** Makes a character suitable for latex printing, i.e. escape critical characters, etc.. */
	static public String format(char c) {
		if (c=='#') return "\\#";
		if (c=='$') return "\\$";
		if (c=='%') return "\\%";
		return ""+c;
	}

}
